// Haxzs Audio Server
// made by omghaxzs
// 2010

#include "clientwnd.h"

clientwnd::clientwnd(int y, int x, int width, int height):window(y, x, width, height)
{
	cursory = 1;
	maxlines = height-2;
	// Initialize curses screen
	if(has_colors() == FALSE)
	{	
		endwin();
		printf("Your terminal does not support color\n");
		exit(1);
	}

	// Create a new window
	win = newwin(height, width, y, x);

	scrollok(win, true);
	box(win, 0, 0);
	wmove(win, 2, 0);
	waddch(win, ACS_LTEE);
	for(int i=0; i<23; i++)
	{
		waddch(win, ACS_HLINE);
	}
	waddch(win, ACS_RTEE);

	// Initially set the cursor
	wmove(win, 1, 1);

	wprintw(win, "Listeners: 0");

	wrefresh(win);
}

clientwnd::~clientwnd()
{
	endwin();
}

void clientwnd::UpdateListenerCount(int count)
{
	std::stringstream num;
	std::string str;

	num << count-1;
	str = "Listeners: ";
	str += num.str();

	wmove(win, 1, 1);
	wprintw(win, str.c_str());
	wrefresh(win);
}

void clientwnd::UpdateListeners()
{
	// Get the current listeners

}